﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;

namespace SacMauVN
{
    public partial class UCProductList : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        public void LoadData(int MenuID)
        {
            string sql = "SELECT TOP 4 * FROM tblSMVNSanPham WHERE Menu_ID = @Menu_ID ORDER BY UpdateDate DESC";
            List<SqlParameter> arrParams = new List<SqlParameter>();
            arrParams.Add(SqlHelper.CreateParameterObject("@Menu_ID", SqlDbType.Int, ParameterDirection.Input, MenuID));
            DataTable dt = SqlHelper.ExecuteDataTable(CommandType.Text, sql, arrParams);
            rptListProduct.DataSource = dt;
            rptListProduct.DataBind();
            hplTitle.Text = SqlHelper.ExecuteScalar(CommandType.Text, "SELECT Ten FROM dbo.tblSMVNMenu WHERE ID = " + MenuID).ToString();
            hplTitle.NavigateUrl = "DanhSachSanPham.aspx?cID=" + MenuID;
        }
    }
}